<link rel="stylesheet" type="text/css" href="<?php echo COMPONENT_PATH."css/jquery.tabs.css"; ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo COMPONENT_PATH."css/jquery.tabs-ie.css"; ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo COMPONENT_PATH."css/datepicker.css"; ?>" />
<link href="<?php echo COMPONENT_PATH."css/facebox/facebox.css"; ?>" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo COMPONENT_PATH."js/application.js"; ?>"></script>
<script>
//script for datepicker
var months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var blocked_dates = new Array();
var original_blocked_dates = "<?php echo $unit->blocked_dates;?>".split(",");
blocked_dates = original_blocked_dates;
function fill_table(month,month_length) {
	var day=1
	// outputs 3 months in a table row
	var per_row = 3
	var month_number = months.indexOf(month)
	
	if(month_number % per_row == 0 && month_number != 0) document.write("</td></tr><tr><td valign=\"top\">")
	else document.write("</td><td valign=\"top\">")
	
	document.write("<TABLE CELLSPACING=0 CELLPADDING=0><TR>")
	document.write("<TD COLSPAN=7 ALIGN=center class=\"MonthHeader\"><B>"+month+"   "+year+"</B><TR class=\"DayTitle\">")
	day_title("Sun")
	day_title("Mon")
	day_title("Tue")
	day_title("Wed")
	day_title("Thu")
	day_title("Fri")
	day_title("Sat")
	document.write("</TR><TR>")

	for (var i=1;i<start_day;i++) {
		document.write("<TD>")
	}
	for (var i=start_day;i<8;i++) {
		var date = day+"/"+month+"/"+year;
		class_name = original_blocked_dates.inArray(date) ? "Blocked" : "UnBlocked";
		document.write("<TD ALIGN=center><a class=\""+ class_name +"\" id=\"date_"+date+"\" href=\"javascript:void(0)\" onclick=\"block('"+date+"')\">"+day+"</a></TD>")
		day++
	}
	document.write("<TR>")
	while (day <= month_length) {
		for (var i=1;i<=7 && day<=month_length;i++) {
			var date = day+"/"+month+"/"+year;
			class_name = original_blocked_dates.inArray(date) ? "Blocked" : "UnBlocked";
			document.write("<TD ALIGN=center><a class=\""+ class_name +"\" id=\"date_"+date+"\" href=\"javascript:void(0)\" onclick=\"block('"+date+"')\">"+day+"</a></TD>")
			day++
		}
		document.write("</TR><TR>")
		start_day=i
	}
	document.write("</TR></TABLE>")
}
function block(date){
	var ele = document.getElementById("date_"+date);
	if(blocked_dates.inArray(date)){
		blocked_dates.splice(blocked_dates.indexOf(date), 1);
		ele.className = "UnBlocked";
	}
	else{
		blocked_dates.push(date);
		ele.className = "Blocked";
	}
}
function day_title(day_name){
	document.write("<TD ALIGN=center WIDTH=35>"+day_name+"</TD>")
}
function get_months(){
	today= new Date("January 1, "+year)
	start_day = today.getDay() + 1 // retrieves the day(sun, mon, etc...) of the first day of that year
	
	fill_table("January",31)
	if (((year % 4)==0) && ((year % 100)!=0) || ((year % 400)==0))
	{ fill_table("February", 29); }
	else { fill_table("February", 28); }
	fill_table("March",31)
	fill_table("April",30)
	fill_table("May",31)
	fill_table("June",30)
	fill_table("July",31)
	fill_table("August",31)
	fill_table("September",30)
	fill_table("October",31)
	fill_table("November",30)
	fill_table("December",31)
	year = year+1;
}
function select_year(option){
	if(option == 1) cur_year += 1;
	else cur_year -= 1;
	if(cur_year > (year-1)) cur_year = year-1;
	else if(cur_year < start_year) cur_year = start_year;
	$("#year_"+(start_year+0)+", #year_"+(start_year+1)+", #year_"+(start_year+2)+", #year_"+(start_year+3)).css("display", "none");
	$("#year_"+cur_year).css("display", "block");
	$("#CurYear").text(cur_year);
}
// script for image display
function display_move(id){
	var arr = $("#" + id + " tr");
	jQuery.each(arr, function(){
		$(this).children("td:first").html($("#middle_row").html());
	});
	$("#" + id + " tr:first td:first").html("<b>Order</b>");
	$("#" + id + " tr:eq(1) td:first").html($("#top_row").html());
	$("#" + id + " tr:last td:first").html($("#bottom_row").html());
}
function alter_order(order1, order2){
	$.post("<?php echo COMPONENT_PATH.'functions/reorder_images.php'?>", {order1: order1, order2: order2, uid: <?php echo $unit->id;?>}, function (data){
		if(data.error == 0){
			$("#images_display").html(data.html);
			alternate('images_display', 'odd', 'even');
			display_move('images_display');
		}
		else alert("error");
	}, "json");
}
</script>
<table border="0">
	<tr class="HeaderTr">
		<td><b><?php echo $unit->address;?></b></td>
	</tr>
	<tr>
	<td>
		<form method="post" action="" name="edit_units_form" enctype="multipart/form-data">
<!--		<div id="TabsContainer" style="visibility:hidden;">-->
			<div id="units_tabs">
				<ul>
					<li><a href="#home_setup"><span>Home Setup</span></a></li>
					<li><a href="#listing_details"><span>Listing Details</span></a></li>
					<li><a href="#ameneties"><span>Ameneties</span></a></li>
					<li><a href="#images"><span>Images</span></a></li>
					<li><a href="#calender"><span>Calender</span></a></li>
					<li><a href="#rates"><span>Rates</span></a></li>
				</ul>
				<div id="home_setup">
					<table border="0" width="100%">
					  <tr>
					    <td colspan="2"><h2><?php echo $unit->address;?></h2></td>
					  </tr>
					  <tr>
					    <td width="20%">Address *: </td>
					    <td><input type="text" size="45" name="units[address]" value="<?php echo $unit->address;?>" /></td>
					  </tr>
					  <tr>
					    <td>Country: </td>
					    <td><input type="text" name="units[country]" value="<?php echo $unit->country;?>" /></td>
					  </tr>
					  <tr>
					    <td>City: </td>
					    <td><input type="text" name="units[city]" value="<?php echo $unit->city;?>" /></td>
					  </tr>
					  <tr>
					    <td>State/Country: </td>
					    <td><input type="text" name="units[state]" value="<?php echo $unit->state;?>" /></td>
					  </tr>
					  <tr>
					    <td>Postcode: </td>
					    <td><input type="text" name="units[postcode]" value="<?php echo $unit->postcode;?>" /></td>
					  </tr>
					  <tr>
					    <td colspan="2"><hr /></td>
					  </tr>
					  <tr>
					    <td>Published: </td>
					    <td>
					    	<select name="units[published]">
					        	<option value="1" <?php echo ($unit->published == 1 ? 'selected="selected"' : '' );?>>Yes</option>
					            <option value="0" <?php echo ($unit->published == 0 ? 'selected="selected"' : '' );?>>No</option>
					        </select>
					    </td>
					  </tr>
					  <tr>
					    <td>Property Category:</td>
					    <td>
					    	<select name="units[category]">
					    	<?php foreach($categories as $category){?>
					        	<option value="<?php echo $category->id;?>" <?php echo ($unit->category == $category->id ? 'selected="selected"' : '' );?>><?php echo $category->name;?></option>
					        <?php }?>
					        </select>
					    </td>
					  </tr>
					  <tr>
					    <td>Maximum Occupancy:</td>
					    <td><input type="text" name="units[maximum_occupancy]" value="<?php echo $unit->maximum_occupancy;?>" /></td>
					  </tr>
					  <tr>
					    <td>Unit Manager:</td>
					    <td>
					    	<select name="units[owner_id]">
					    	<option value="0">Select a Manager</option>
					    	<?php foreach($managers as $manager){?>
					        	<option value="<?php echo $manager->id;?>" <?php echo ($manager->id == $unit->owner_id ? 'selected="selected"' : '' );?>><?php echo $manager->firstname." ".$manager->surname;?></option>
							<?php }?>
					        </select>
					    </td>
					  </tr>
					  <tr>
					    <td colspan="2"><hr /></td>
					  </tr>
					  <tr>
					    <td>Management Company Name: </td>
					    <td><input type="text" size="45" name="units[mgmt_company_name]" value="<?php echo $unit->mgmt_company_name;?>" /></td>
					  </tr>
					  <tr>
					    <td>Local Phone Number: </td>
					    <td><input type="text" name="units[local_phone_number]" value="<?php echo $unit->local_phone_number;?>" /></td>
					  </tr>
					  <tr>
					    <td>Villa phone Number: </td>
					    <td><input type="text" name="units[villa_phone_number]" value="<?php echo $unit->villa_phone_number;?>" /></td>
					  </tr>
					  <tr>
					    <td>Local Contact Name: </td>
					    <td><input type="text" name="units[local_contact_name]" value="<?php echo $unit->local_contact_name;?>" /></td>
					  </tr>
					  <tr>
					    <td>Key Lockbox Code:</td>
					    <td><input type="text" name="units[lockbox_code]" value="<?php echo $unit->lockbox_code;?>" /></td>
					  </tr>
					  <tr>
					    <td colspan="2"><hr /></td>
					  </tr>
					  <tr>
					  	<td>Driving Direction:</td>
					    <td><?php echo editorArea( 'editor', $unit->driving_direction, 'units[driving_direction]', '100%;', '300', '10', '30' ) ;?></td>
					  </tr>
					  <tr>
					    <td colspan="2"><hr /></td>
					  </tr>
					  <tr>
					    <td>Title: </td>
					    <td>
					    	<input type="text" name="units[name]" value="<?php echo $unit->name;?>" />&nbsp;&nbsp;&nbsp;
					    	<input type="checkbox" name="units[title_as_pagetitle]" id="page_title" value="<?php echo $unit->title_as_pagetitle;?>" <?php echo($unit->title_as_pagetitle == 1 ? 'checked' : '');?> /><label for="page_title">Set as Page Title</label>
					    </td>
					  </tr>
					  <tr>
					    <td>Keywords: </td>
					    <td><textarea name="units[keywords]" cols="20"><?php echo $unit->keywords; ?></textarea></td>
					  </tr>
					  <tr>
					    <td colspan="2"><hr /></td>
					  </tr>
					</table>
				</div>
				<div id="listing_details">
					<table border="0" width="100%">
					  <tr>
					    <td colspan="2"><h2><?php echo $unit->address;?></h2></td>
					  </tr>
					  <tr>
					    <td width="20%">Listing Title *: </td>
					    <td><input type="text" size="45" name="units[title]" value="<?php echo $unit->title;?>" /></td>
					  </tr>
					  <tr>
					    <td>Bedrooms: </td>
					    <td><input type="text" size="5" name="units[bedrooms]" value="<?php echo $unit->bedrooms;?>" /></td>
					  </tr>
					  <tr>
					    <td>Bathrooms: </td>
					    <td><input type="text" size="5" name="units[bathrooms]" value="<?php echo $unit->bathrooms;?>" /></td>
					  </tr>
					  <tr>
					    <td colspan="2"><hr /></td>
					  </tr>
					  <tr>
					    <td>Summary: <br />(Limit 250 Characters)</td>
					    <td>
					    	<textarea name="units[summary]" cols="50" rows="10" onkeyup="change(this, 250, 'chars_left')"><?php echo $unit->summary;?></textarea><br />
					    	You have <span id="chars_left">250</span> characters left.
					    </td>
					  </tr>
					  <tr>
					    <td colspan="2"><hr /></td>
					  </tr>
					  <tr>
					    <td>Description:</td>
					    <td><?php echo editorArea( 'editor', $unit->description, 'units[description]', '100%;', '250', '10', '30' ) ;?></td>
					  </tr>
					  <tr>
					    <td colspan="2"><hr /></td>
					  </tr>
					  <tr>
					    <td>Virtual Tour Link:</td>
					    <td><input type="text" size="45" name="units[virtual_tour_link]" value="<?php echo $unit->virtual_tour_link;?>" /></td>
					  </tr>
					  <tr>
					    <td colspan="2"><hr /></td>
					  </tr>
					</table>
				</div>
				<div id="ameneties">
					<table border="0" width="100%">
					  <tr>
					    <td colspan="2"><h2><?php echo $unit->address;?></h2></td>
					  </tr>
					  <tr>
					  	<td>
					  		<table border="0">
					  			<tr>
					  			<?php if(!empty($amenities)){
					  				$per_row = 3;
					  				foreach($amenities as $key=>$amenity){
					  			?>
					  				<?php echo (($key % $per_row == 0 && $key != 0) ? "</td></tr><tr>" : "</td>" );?>
					  				<td valign="middle" width="33%"><input type="checkbox" id="amenity_<?php echo $key;?>" name="amenities[]" value="<?php echo $amenity->id;?>" <?php echo (in_array($amenity->id, $unit->amenities) ? "checked" : "");?>> <label for="amenity_<?php echo $key;?>"><?php echo $amenity->name;?></label>
					  			<?php 
					  				}
					  			}?>
					  			</tr>
					  		</table>
					  	</td>
					  </tr>
					</table>
				</div>
				<div id="images">
					<table border="0" width="100%">
					  <tr>
					    <td colspan="2"><h2><?php echo $unit->address;?></h2></td>
					  </tr>
					  <tr>
					  	<td align="left" valign="middle">
					  		To add a picture, click browse, select the picture and click upload picture<br />
					  		<input type="file" name="upload_image" size="45" />
					  		<input type="hidden" id="upload_image_form" name="upload_image_form" value="" />
					  		<input type="button" value="Upload Image" onclick="do_upload();">
					  		<span id="loader" class="Loader"><img alt="Loading..." src="<?php echo COMPONENT_PATH."images/loader.gif";?>"></span>
					  	</td>
					  </tr>
					  <tr>
					  	<td>
					  		<table border="0">
					  		<tbody id="images_display">
							  <tr>
							  	<td colspan="5"><b>Order</b></td>
							  </tr>	
							  <?php if(!empty($images)){?>
							  <?php foreach($images as $image){?>
							  <tr id="row_<?php echo $image->id;?>">
							    <td width="5%">&nbsp;</td>
							    <td width="25%" align="center">
							    	<input type="hidden" name="image_order" value="<?php echo $image->order;?>">
							    	<img src="<?php echo $image->thumbnailurl;?>" alt="">
							    </td>
							    <td width="" valign="middle">Caption 
							    	<input type="text" size="45" name="caption" value="<?php echo $image->caption;?>" />
							    	<a href="javascript:void(0)" onclick="save_caption($(this), <?php echo $image->id;?>)"><img alt="save" src="<?php echo COMPONENT_PATH."images/save.jpg"?>"></a>
							    	<span class="Loader"><img alt="save" src="<?php echo COMPONENT_PATH."images/loading-icon.gif"?>"></span>
							   	</td>
							    <td width="5%" valign="middle"><a href="<?php echo $image->photourl;?>" rel="facebox"><img alt="zoom" src="<?php echo COMPONENT_PATH."images/zoom.png"?>"></a></td>
							    <td width="5%" valign="middle">
							    	<a href="javascript:void(0)" class="Delete" onclick="delete_image(<?php echo $image->id;?>)">
							    		<img alt="delete" src="<?php echo COMPONENT_PATH."images/cross.png"?>">
							    	</a>
							    </td>
							  </tr>
							  <?php }
							  }
							  ?>
							</tbody>
							</table>
							<div id="top_row" style="display:none;">
								<a href="javascript:void(0);" onclick="alter_order($(this).parent().parent().children('td:eq(1)').children('input').val(),$(this).parent().parent().next('tr').children('td:eq(1)').children('input').val())"><img src="<?php echo COMPONENT_PATH."images/downarrow.png"?>" alt="down" /></a>
							</div>
							<div id="middle_row" style="display:none;">
								<a href="javascript:void(0);" onclick="alter_order($(this).parent().parent().children('td:eq(1)').children('input').val(),$(this).parent().parent().prev('tr').children('td:eq(1)').children('input').val())"><img src="<?php echo COMPONENT_PATH."images/uparrow.png"?>" alt="up" /></a>&nbsp;
								<a href="javascript:void(0);" onclick="alter_order($(this).parent().parent().children('td:eq(1)').children('input').val(),$(this).parent().parent().next('tr').children('td:eq(1)').children('input').val())"><img src="<?php echo COMPONENT_PATH."images/downarrow.png"?>" alt="down" /></a></div>
							<div id="bottom_row" style="display:none;">
								<a href="javascript:void(0);" onclick="alter_order($(this).parent().parent().children('td:eq(1)').children('input').val(),$(this).parent().parent().prev('tr').children('td:eq(1)').children('input').val())"><img src="<?php echo COMPONENT_PATH."images/uparrow.png"?>" alt="up" /></a>
							</div>
							<script type="text/javascript">
								alternate('images_display', 'odd', 'even');
								display_move('images_display');
							</script>
							<div id="div1"></div>
					  	</td>
					  </tr>
					</table>
				</div>
				<div id="calender">
					<SCRIPT type="text/javascript" language="JavaScript">
					today = new Date();
					var year = today.getYear(); // changes as years are printed
					if (year < 2000) year = year + 1900; // Y2K Fix, Isaac Powell "http://onyx.idbsu.edu/~ipowell"
					var start_year = year; // the first year (constant)
					var cur_year = year; // the current selected year
	
					document.write("<div id=\"CalenderWrapper\"><div id=\"CalenderNavigation\"><a href=\"javascript:void(0);\" onclick=\"select_year(-1)\"><img src=\"<?php echo COMPONENT_PATH.'images/year_less.jpg'?>\" /></a>")
					document.write("<span id=\"CurYear\">"+ cur_year +"</span>");
					document.write("<a href=\"javascript:void(0);\" onclick=\"select_year(1)\"><img src=\"<?php echo COMPONENT_PATH.'images/year_more.jpg'?>\" /></a></div>")
					for(var i=0; i<4; i++){
						document.write("<div id=\"year_"+(start_year+i)+"\" style=\"display:" + (i==0 ? 'block':'none') + "\"><table><tr>");
						get_months();
						document.write("</td></tr></table></div>");
					}
					document.write("</div>");
					</SCRIPT>				
				</div>
				<div id="rates">
					<table border="0" width="100%">
					  <tr>
					    <td colspan="3"><h2><?php echo $unit->address;?></h2></td>
					  </tr>
					  <tr>
					    <td><b>Start Period</b></td>
					    <td><b>End Period</b></td>
					    <td><b>Price</b></td>
					  </tr>
					  <?php 
					  $carry_key = 0;
					  if(!empty($prices)){
					  	foreach($prices as $key=>$price){
					  ?>
					  <tr>
					    <td><input id="start_date_<?php echo $key;?>" type="text" class="date_pick DatePeriod StartDate" name="prices[startdate][]" value="<?php echo get_string_from_date($price->startdate);?>" />
					    <input type="hidden" name="prices[id][]" value="<?php echo $price->id;?>" /></td>
					    <td><input id="end_date_<?php echo $key;?>" type="text" class="date_pick DatePeriod EndDate" name="prices[enddate][]" value="<?php echo get_string_from_date($price->enddate);?>" /></td>
					    <td><input type="text" size="5" class="DatePeriod" name="prices[price][]" value="<?php echo $price->price;?>" /></td>
					  </tr>
					  <?php
					  		$carry_key++;
						 }
					  }
					  if($prices_count < 10){
					  	for($i = 0; $i < 10 - $prices_count; $i++){
					  ?>
					  <tr>
					    <td><input id="start_date_<?php echo ($carry_key+$i);?>" type="text" class="date_pick DatePeriod StartDate" name="prices[startdate][]" /></td>
					    <td><input id="end_date_<?php echo ($carry_key+$i);?>" type="text" class="date_pick DatePeriod EndDate" name="prices[enddate][]" /></td>
					    <td><input type="text" size="5" class="DatePeriod" name="prices[price][]" /></td>
					  </tr>
					  <?php }
					  }
					  ?>
					</table>
				</div>
			</div>
			<input type="hidden" name="form" value="edit_units">
			<input type="hidden" id="blocked_dates" name="units[blocked_dates]" value="">
			<input type="hidden" name="r" id="r" value="">
<!--		</div>-->
<!--		<div id="Loading"><b>Loading Data...</b></div>-->
		</form>
	</td>
	</tr>
</table>
<?php $KToolBar->addLink('<a href="#" onclick="submit_form(\'edit_units_form\')"><img border="0" alt="Save" src="images/save_f2.png"/><br />Save</a>');?>
<?php $KToolBar->addLink('<a href="?option='.COMPONENT_NAME.'"><img border="0" alt="Cancel" src="images/cancel_f2.png"/><br />Cancel</a>');?>
<iframe style="display:none; width:800px; height: 300px;" id="image_uploader" name="image_uploader" src="<?php echo COMPONENT_PATH;?>functions/image_uploader.php"></iframe>
<script type="text/javascript" src="<?php echo COMPONENT_PATH."js/jquery.history_remote.js"; ?>" charset="ISO-8859-1"></script>
<script type="text/javascript" src="<?php echo COMPONENT_PATH."js/jquery.tabs.js"; ?>" charset="ISO-8859-1"></script>
<script type="text/javascript" src="<?php echo COMPONENT_PATH."js/date.js"; ?>" charset="ISO-8859-1"></script>
<script type="text/javascript" src="<?php echo COMPONENT_PATH."js/jquery.datePicker.js"; ?>" charset="ISO-8859-1"></script>
<script type="text/javascript" src="<?php echo COMPONENT_PATH."js/facebox.js"; ?>" charset="ISO-8859-1"></script>

<script type="text/javascript">
Date.firstDayOfWeek = 0;
Date.format = 'mm/dd/yyyy';
$(document).ready(function() {
	$('a[rel*=facebox]').facebox({
		closeImage: "<?php echo COMPONENT_PATH."css/facebox/closelabel.gif"; ?>",
		loadingImage: "<?php echo COMPONENT_PATH."css/facebox/loading.gif"; ?>"
	});
	$('.date_pick').datePicker();
	$('.StartDate').bind(
			'dpClosed',
			function(e, selectedDates)
			{
				var index = $('.StartDate').index(this);
				var d = selectedDates[0];
				if (d) {
					d = new Date(d);
					$('.EndDate:eq('+index+')').dpSetStartDate(d.addDays(1).asString());
				}
			}
	);
	$('.EndDate').bind(
		'dpClosed',
		function(e, selectedDates)
		{
			var index = $('.EndDate').index(this);
			var d = selectedDates[0];
			if (d) {
				d = new Date(d);
				$('.StartDate:eq('+index+')').dpSetEndDate(d.addDays(-1).asString());
			}
		}
	);
	$('#units_tabs').tabs();
});
function submit_form(form){
	$('#blocked_dates').val(blocked_dates.join()); // comma is the default separator for join
	$('#r').val(Math.random());
	$('form[name='+form+']').submit();
}
function do_upload(){
	var form = $("form[name=edit_units_form]");
	form.attr("target","image_uploader");
	$("#upload_image_form").val("image");
	$("#loader").css("display","inline");
	form.submit();
}
function save_caption(ele, id){
	var caption = ele.prev("INPUT").val();
	var span = ele.next("SPAN");
	span.css("display", "inline");
	$.post("<?php echo COMPONENT_PATH.'functions/save_caption.php';?>", { caption: caption, id: id },
	function(data){
		span.css("display", "none");
		if(data == "error") alert("Could not saved your data");
	});
}
function delete_image(id){
	if(confirm("Are you sure to delete this image?")){
		$("#row_"+id).remove();
		$.post("<?php echo COMPONENT_PATH.'functions/delete_images.php';?>", { id: id },
		function(data){
			if(data == "error") alert("Failed to delete the specified image");
			else {
				alternate('images_display', 'odd', 'even');
				display_move('images_display');
			}
		});
	}
}
function image_upload_return(id, thumbnails_path, image_path, order){
	$("#images_display").append('\
		<tr id="row_'+ id +'">\
		    <td width="5%">&nbsp;</td>\
		    <td width="25%" align="center"><input type="hidden" name="image_id" value="'+ order +'"><img src="'+thumbnails_path+'" alt=""></td>\
		    <td width="" valign="middle">Caption \
		    	<input type="text" size="45" name="caption" value="" />\
		    	<a href="#images" onclick="save_caption($(this), '+id+')"><img alt="save" src="<?php echo COMPONENT_PATH."images/save.jpg"?>"></a>\
		    	<span class="Loader"><img alt="save" src="<?php echo COMPONENT_PATH."images/loading-icon.gif"?>"></span>\
		   	</td>\
		    <td width="5%" valign="middle"><a href="'+image_path+'" rel="facebox"><img alt="zoom" src="<?php echo COMPONENT_PATH."images/zoom.png"?>"></a></td>\
		    <td width="5%" valign="middle">\
		    	<a href="#images" onclick="delete_image('+id+')">\
		    		<img alt="delete" src="<?php echo COMPONENT_PATH."images/cross.png"?>">\
		    	</a>\
		    </td>\
		</tr>\
	');
	jQuery('#images_display tr:last a[rel=facebox] ').facebox({
		closeImage: "<?php echo COMPONENT_PATH.'css/facebox/closelabel.gif';?>",
		loadingImage: "<?php echo COMPONENT_PATH.'css/facebox/loading.gif';?>"
	});
	alternate('images_display', 'odd', 'even');
	display_move('images_display');
}
</script>
